{{- if and (.Values.allInOne.enabled) (.Values.allInOne.ingress.enabled) -}}
{{- $ingressSupportsIngressClassName := eq (include "common.ingress.supportsIngressClassname" .) "true" }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ template "jaeger.query.name" . }}
  labels:
    {{- include "jaeger.labels" . | nindent 4 }}
    app.kubernetes.io/component: all-in-one
  {{- if .Values.allInOne.ingress.annotations }}
  annotations:
    {{- toYaml .Values.allInOne.ingress.annotations | nindent 4 }}
  {{- end }}
spec:
  {{- if and $ingressSupportsIngressClassName .Values.allInOne.ingress.ingressClassName }}
  ingressClassName: {{ .Values.allInOne.ingress.ingressClassName }}
  {{- end }}
  rules:
    {{- range $host := .Values.allInOne.ingress.hosts }}
    - host: {{ $host }}
      http:
        paths:
          - path: /
            {{- if eq "true" (include "common.ingress.supportsPathType" $) }}
            pathType: ImplementationSpecific
            {{- end }}
            backend: {{- include "common.ingress.backend" (dict "serviceName" (include "jaeger.query.name" $) "servicePort" 16686 "context" $) | nindent 14 }}
  {{- end -}}
  {{- if .Values.allInOne.ingress.tls }}
  tls:
  {{- toYaml .Values.allInOne.ingress.tls | nindent 4 }}
  {{- end -}}
{{- end -}}
